package it.fuesi.bubblekids.views;

import android.graphics.Color;
import android.graphics.Paint;

import it.fuesi.bubblekids.activities.MainActivity;
import it.fuesi.bubblekids.utils.FormatUtils;

/**
 * Created by pascotto on 07/11/14.
 */
public class CircleArea {
    int radius;
    int centerX;
    int centerY;
    int id;
    int[] colors = new int[2];
    int strokeColor;
    int score = 1;

    private static int[] COLORS = {Color.BLUE, Color.RED, Color.GREEN, Color.YELLOW, Color.CYAN, Color.MAGENTA, Color.BLACK};


    boolean reachedTopBoundaries = true;
    boolean reachedBottomBoundaries = false;
    boolean reachedLeftBoundaries = true;
    boolean reachedRightBoundaries = false;

    public static final int MOVING_GAP = 10;

    public CircleArea(int centerX, int centerY, int radius) {
        this.radius = radius;
        this.centerX = centerX;
        this.centerY = centerY;
        generateCirclePaint();
        calculateScore();
    }

    private void calculateScore(){
        this.score = 300-radius;
    }

    private void generateCirclePaint(){
        colors[0] = COLORS[FormatUtils.randInt(0, COLORS.length - 1)];
        colors[1] = COLORS[FormatUtils.randInt(0, COLORS.length-1)];

        strokeColor = COLORS[FormatUtils.randInt(0, COLORS.length-1)];

    }

    public void reachedTopBoundaries() {
        reachedTopBoundaries = true;
        reachedBottomBoundaries = false;
    }

    public void reachedBottomBoundaries() {
        reachedBottomBoundaries = true;
        reachedTopBoundaries = false;
    }

    public void reachedLeftBoundaries() {
        reachedLeftBoundaries = true;
        reachedRightBoundaries = false;
    }

    public void reachedRightBoundaries() {
        reachedRightBoundaries = true;
        reachedLeftBoundaries = false;
    }

    public void move(){
        if(reachedTopBoundaries)
            centerY += MOVING_GAP;
        else
            centerY -= MOVING_GAP;

        if(reachedLeftBoundaries)
            centerX += MOVING_GAP;
        else
            centerX -= MOVING_GAP;

    }

    @Override
    public String toString() {
        return "Circle[" + centerX + ", " + centerY + ", " + radius + "]";
    }
}